home *** CD-ROM | disk | FTP | other *** search
- >Try not to use anything but integers for games. Many may disagree, but
- >it is simply the only way to go. Especially since the compiler doesn't
- >work well with floats and not always with math functions. In airTaxi, I
- >had a purple sphere magnet that would pull all the cars toward itself.
- >This involved some basic vector and magnetism functions, but I used all
- >integers to do it. Simply have an X value that represents 1/100th of a
- >pixel, same with Y. Then set dx or dy to 100 and the other to cos/sin * 100.
- >Your routine will perform faster too. If you need more accuracy, use 256
- >or more instead of 100. Just divide by the number to get the real pixel
- >position.
-
- Right - this offers lots of speed. But then you have to watch out for
- the compiler's division bug - if you use negative numbers in division, it
- rounds the wrong way. Having a separate "direction" variable can fix this,
- bug it's still annoying.
-
- --Andy Church (achurch@goober.mbhs.edu)
- WWW: http://www.mbhs.edu/~achurch/
- AMOS Web Site: http://www.mbhs.edu/~achurch/amos/
-
-